home *** CD-ROM | disk | FTP | other *** search
/ Best of Shareware / Best of PC Windows Shareware 1.0 - Wayzata Technology (7111) (1993).iso / mac / DOS / CAD_CAM / A7221V1B / HP7221.H < prev    next >
Text File  |  1992-03-12  |  11KB  |  274 lines

  1. /*
  2.    Module:  hp7221.h
  3.    Date:    3/9/92
  4.    Version: 1.0b
  5.    Author:  Dave Lutz
  6.    Email:   lutz@psych.rochester.edu
  7.    Copyright: 1992 University of Rochester, Psychology Dept.
  8.  
  9.    Disclaimer:  This software is distributed free of charge.  As such, it
  10.                 comes with ABSOLUTELY NO WARRANTY.  The user of the software
  11.                 assumes ALL RISKS associated with its use.
  12.  
  13.                 Your rights to modify and/or distribute this software are
  14.                 outlined in the file ADI7221.DOC.
  15.  
  16.    Purpose: This module provides function prototypes for the functions 
  17.             used to assemble the codes that are to be sent to the HP 7221 
  18.             plotter.  Each function assembles a char array of codes that are 
  19.             used to represent the desired plotter functions.  The resulting 
  20.             arrays are then output via the putarr function that is provided 
  21.             by the generic ADI module.
  22.  
  23.             DEV_WELCOME is also define here.  This defines arguements for a
  24.             printf statement that will be called during program startup.
  25.  
  26.    Functions provided:
  27.  
  28.         dev_beginplot
  29.         dev_endplot
  30.         dev_move
  31.         dev_draw
  32.         dev_newpen      (automatic pen selection)
  33.         dev_setspeed
  34.         dev_linetype
  35.         dev_penchange   (pen up for manual pen change)
  36.         dev_abortplot
  37.  
  38.         Note: When a dev_penchange is called, the main driver is expected
  39.         to pause while the operator manually changes the pen.  If this is
  40.         not possible (ie the driver is not a direct feed to the plotter),
  41.         dev_penchange should not be called.
  42.  
  43. */
  44.  
  45. /* the welcome message for the main program */
  46. #define DEV_WELCOME "ADI7221 1.0b.  University of Rochester, Psychology Dept.\n\n"
  47.  
  48.  
  49. /*
  50.    Function: dev_beginplot
  51.    Purpose:  Produces the code used to initialize the plotter for a new
  52.              plot.
  53.  
  54.    Pre: pltfp is a pointer to a PLTFILE that has been opened for writing.
  55.  
  56.    Post: The char array of codes necessary to initialize the plotter is 
  57.          output via putarr().  The array contains the HP_BEGINPLOT code.
  58.          If putarr() returns an error, BADIO is returned.
  59.          Otherwise TRUE is returned.
  60. */
  61.  
  62. int dev_beginplot (PLTFILE *pltfp);
  63.  
  64.  
  65.  
  66. /*
  67.    Function: dev_endplot
  68.    Purpose:  Produces the code used to signal the plotter that the current
  69.              plot is complete.
  70.  
  71.    Pre: pltfp is a pointer to a PLTFILE that has been opened for writing.
  72.         The global variable 'drawing' indicates whether a draw is currently
  73.         in progess.
  74.  
  75.    Post: The char array of codes necessary to signal the end of a plot is 
  76.          output via putarr().
  77.          If the global variable 'drawing' is TRUE, it is set FALSE, and the 
  78.          array begins with the HP_END_DRAW code. The array always contains 
  79.          the HP_ENDPLOT code.
  80.          If putarr() returns an error, BADIO is returned.
  81.          Otherwise TRUE is returned.
  82. */
  83.  
  84. int dev_endplot (PLTFILE *pltfp);
  85.  
  86.  
  87.  
  88. /*
  89.    Function: dev_move
  90.    Purpose:  Produces the code used to cause the plotter to perform a pen 
  91.              up move.
  92.  
  93.    Pre: xcoord contains the X coordinate of the ending location of the move.
  94.         ycoord contains the Y coordinate of the ending location of the move.
  95.         pltfp is a pointer to a PLTFILE that has been opened for writing.
  96.         The global variable 'drawing' indicates if a draw is currently in
  97.         progress.
  98.  
  99.    Post: The char array of codes necessary to perform a pen up move is 
  100.          output via putarr().
  101.          If the global variable 'drawing' is TRUE, it is set FALSE and the
  102.          array begins with the HP_END_DRAW code.  
  103.          The array always includes: the HP_MOVE code, the MBP formatted 
  104.          representation of xcoord and ycoord, and the HP_END_MOVE code.
  105.          If xcoord or ycoord are out of range, BADFMT is returned.
  106.          If putarr returns an error, BADIO is returned.
  107.          Otherwise TRUE is returned.
  108. */
  109.  
  110. int dev_move (unsigned xcoord, unsigned ycoord, PLTFILE *pltfp);
  111.  
  112.  
  113.  
  114. /*
  115.    Function: dev_draw
  116.    Purpose:  Produces the code used to cause the plotter to perform a pen
  117.              down draw.
  118.  
  119.    Pre: xcoord contains the X coordinate of the ending location of the draw.
  120.         ycoord contains the Y coordinate of the ending location of the draw.
  121.         pltfp is a pointer to a PLTFILE that has been opened for writing.
  122.         The global variable 'drawing' indicates whether or not a draw is 
  123.         currently in progress.
  124.  
  125.    Post: The char array of codes necessary to perform a pen down draw is 
  126.          output via putarr().
  127.          If the global variable 'drawing' is initially TRUE, the array
  128.          contains only the MBP formatted representation of xcoord and ycoord.
  129.          Otherwise, 'drawing' is set TRUE, and the array contains the
  130.          HP_DRAW code, followed by the MBP formatted representation of
  131.          xcoord and ycoord.
  132.          If xcoord or ycoord are out of range, BADFMT is returned. 
  133.          If putarr() returns an error, BADIO is returned.
  134.          Otherwise TRUE is returned.
  135. */
  136.  
  137. int dev_draw (unsigned xcoord, unsigned ycoord, PLTFILE *pltfp);
  138.  
  139.  
  140.  
  141. /*
  142.    Function: dev_newpen
  143.    Purpose:  Produces the code used to cause the plotter to automatically
  144.              select a new pen.
  145.  
  146.    Pre: pennum contains the number of the pen to be selected.
  147.         pltfp is a pointer to a PLTFILE that has been opened for writing.
  148.         The global variable 'drawing' indicates whether a draw is currently
  149.         in progress.
  150.  
  151.    Post: The char array of codes necessary to perform an automatic pen 
  152.          select is output via putarr().
  153.          If the global variable 'drawing' is TRUE, it is set FALSE and the
  154.          array begins with the HP_END_DRAW code.  
  155.          The array always includes the HP_NEWPEN code followed by the SBN
  156.          formatted representation of pennum.
  157.          If pennum is out of range, BADFMT is returned. 
  158.          If putarr() returns an error, BADIO is returned.
  159.          Otherwise TRUE is returned.
  160. */
  161.  
  162. int dev_newpen (unsigned pennum, PLTFILE *pltfp);
  163.  
  164.  
  165.  
  166. /*
  167.    Function: dev_setspeed
  168.    Purpose:  Produces the code used to cause the plotter to select a new
  169.              pen speed.
  170.  
  171.    Pre: speed contains the code for the new speed.
  172.         pltfp is a pointer to a PLTFILE that has been opened for writing.
  173.         The global variable 'drawing' indicates whether a draw is currently
  174.         in progress.
  175.  
  176.    Post: The char array of codes necessary to cause the plotter to select 
  177.          a new speed is output via putarr().
  178.          If speed is out of range, BADFMT is returned. 
  179.          If the global variable 'drawing' is TRUE, it is set FALSE and the
  180.          array begins with the HP_END_DRAW code.  
  181.          The array always includes the HP_SETSPEED code followed by the SBN
  182.          fomatted representation of speed.
  183.          If putarr() returns an error, BADIO is returned.
  184.          Otherwise TRUE is returned.
  185. */
  186.  
  187. int dev_setspeed (unsigned speed, PLTFILE *pltfp);
  188.  
  189.  
  190.  
  191. /*
  192.    Function: dev_linetype
  193.    Purpose:  Produces the code needed to cause the plotter to beging using a
  194.              different line type for subesequent draw commands.
  195.  
  196.              Currently supported line types are:
  197.  
  198.                 (0)  ----------------------------------- (solid)
  199.                 (1)  -- -- -- -- -- -- -- -- -- -- -- -- (dashed)
  200.                 (2)  - - - - - - - - - - - - - - - - - - (hidden)
  201.                 (3)  ---- - ---- - ---- - ---- - ---- -  (center)
  202.                 (4)  ----- - - ----- - - ----- - - ----- (phantom)
  203.                 (5)  ................................... (dot)
  204.                 (6)  -- . -- . -- . -- . -- . -- . -- .  (dashdot)
  205.                 (7)  -- -- . -- -- . -- -- . -- -- . --  (border)
  206.                 (8)  -- .. -- .. -- .. -- .. -- .. -- .. (divide)
  207.         
  208.    Pre: linecode contains the code for the desired line type.
  209.         pltfp is a pointer to a PLTFILE that has been opened for writing.
  210.         The global variable 'drawing' indicates whether a draw is currently
  211.         in progress.
  212.  
  213.    Post: The char array of codes necessary to cause the plotter to begin 
  214.          using a different line type is output via putarr().
  215.          If linecode is out of range, BADFMT is returned. 
  216.          If the global variable 'drawing' is TRUE, it is set FALSE and the
  217.          array begins with the HP_END_DRAW code.
  218.          The array always contains the HP_LINETYPE code followed by the
  219.          SBN and MBN representations of the code required to set the desired 
  220.          line type.
  221.          If putarr() returns an error, BADIO is returned.
  222.          Otherwise TRUE is returned.
  223.  
  224.          If the module is compiled with VARIABLE_DASHES defined, patterns
  225.          in the lines will be varied so that an integral number of patterns
  226.          will be included in each line segment.  If VARIABLE_DASHES is not
  227.          defined, fixed length patterns will be used without regard for
  228.          the completeness of each pattern. (ie short line segments may not
  229.          include a complete pattern)
  230. */
  231.  
  232. int dev_linetype (unsigned linecode, PLTFILE *pltfp);
  233.  
  234.  
  235.  
  236. /*
  237.    Function: dev_penchange
  238.    Purpose:  Produces the code needed to raise the pen so that the main
  239.              program can pause and allow the operator to manually change
  240.              pens.
  241.  
  242.    Pre: pltfp is a pointer to a PLTFILE that has been opened for writing.
  243.         The global variable 'drawing' indicates whether a draw is currently
  244.         in progress.
  245.  
  246.    Post: The char array of codes needed to cause the plotter to raise the 
  247.          pen is output via putarr().
  248.          If the global variable 'drawing' is TRUE, it is set FALSE and the
  249.          array begins with the HP_END_DRAW code.  
  250.          The array always contains the HP_PENCHANGE code.
  251.          If putarr() returns an error, BADIO is returned.
  252.          Otherwise, TRUE is returned.
  253. */
  254.  
  255. int dev_penchange (PLTFILE *pltfp);
  256.  
  257.  
  258.  
  259. /*
  260.    Function: dev_abortplot
  261.    Purpose:  Produces the code needed to cause the plotter to abort all
  262.              actions related to the current plot.
  263.  
  264.    Pre: pltfp is a pointer to a PLTFILE that has been opened for writing.
  265.  
  266.    Post: The char array of codes needed to cause the plotter to abort the 
  267.          current plot is output via putarr().
  268.          The array contains the HP_ABORTPLOT code.
  269.          If putarr() returns an error, BADIO is returned.
  270.          Otherwise, TRUE is returned.
  271. */
  272.  
  273. int dev_abortplot (PLTFILE *pltfp);
  274.